<%@ page contentType="text/html;charset=UTF-8"%>
<html>
<head>
    <title>支付</title>
    <script src="/js/jquery-3.2.1.min.js"></script>
    <script src="/js/qrcode.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/bootstrap-theme.min.css">
</head>

<body>
    <div class="container">
        <div class="row">
            <p class="text-center"><h2>扫码支付</h2></p>
        </div>
        <div class="col-md-8">
            <form name="reqForm">
                <div class="form-group">
                    <label for="partnerId">平台ID</label>
                    <input type="text" class="form-control" value="test" name="partnerId" id="partnerId" placeholder="平台ID">
                </div>
                <button type="button" id="btn" class="btn btn-primary">生成二维码</button>
            </form>
            <div class="form-group">
                <input type="text" class="form-control" id="furl">
                <button type="button" id="forward" class="btn btn-default">跳转</button>
            </div>
        </div>
        <div class="col-md-4">
            <div id="qrcode"></div>
        </div>
    </div>
</body>

<script type="text/javascript">
    var qrcode;
    $(function() {
        qrcode = new QRCode(document.getElementById("qrcode"), "");
    });

    $("#btn").click(function () {
        var reqHost = "http://"+window.location.host+"/cashier/"+$("#partnerId").val();
        qrcode.clear();
        qrcode.makeCode(reqHost);
    });

    $("#forward").click(function () {
        var reqHost = "http://"+window.location.host+"/cashier/"+$("#partnerId").val();
        window.location.href= reqHost;
    });
</script>

</html>